Notion sped up its web browser application by implementing SQLite caching using WebAssembly. It faced challenges with cross-origin isolation and data corruption due to concurrency issues when multiple tabs accessed the database simultaneously. Notion resolved these issues by developing a SharedWorker architecture where only one tab actively interacts with the SQLite database while others can still make queries. It also addressed regressions like slower load times and performance issues on slow devices by loading the WASM SQLite library asynchronously and implementing a “race” mechanism between SQLite and API requests.
Thursday, July 18, 2024